<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@taglib uri="/struts-tags" prefix="s"%>
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>OA协同办公系统</title>
<link type="text/css" rel="stylesheet" href="css/table.css">
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/openwindow.js"></script>
<script type="text/javascript" src="js/file.js"></script>
<script src="js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
		<style type="text/css">
		body,td,th {
			font-family: "宋体";
			font-size: 12px;
		}
		.sendtd{border-bottom:#F00 double 1px}
		td{ color:#F00}
		.ztable{margin:15px 0 15px 0}
		</style>
	<script type="text/javascript">
	function update(){
		var url="updateSysDocument.action";
		$.post(url,$("form").serialize(),function(data){
			if(data=="success"){
				alert("操作成功");
				window.close();
				var currentPage=$("#currentPage").val();
				window.opener.page(currentPage);
			}else{
				alert("操作失败");
			}
		});
	}
function addSubject(){
	var url="addSubjectOut.action";
	openWindow(url,500,500);
}

function saveText(val,tem){
	}
function subjectAddouts(val){
	$("#ztc").val(val)
}
function download() {
	var fileId = $("#fileArray").val();
	if (fileId != "" && fileId != "null") {
		var param = {"fileArray":fileId};
		$.post("getFileList.action", param, function (data) {
			var list = data.fileList;
			for (var i = 0; i < list.length; i++) {
				$("#filetable").prepend("<tr><td><input type=\"checkbox\" name=\"checkbox2\" id=\"" + list[i].id + "\" value=\"" + list[i].id + "\" />&nbsp;<a href=\"downLoadFile.action?fileId=" + list[i].id + "\">" + list[i].name + "</a>&nbsp;</tr>");
			}
		}, "json");
	}
}
function draftWord(val) {
	var id=$("#contentid").val();
	var docId=$("#docId").val();
	var template=$("#template").val();
	var wt=$("#wt").val();
	var postFont1=$("#postFont1").val();
	var postFont2=$("#postFont2").val();
	var postFont3=$("#postFont3").val();
	var fwbt=$("#fwbt").val();
	var ztc=$("#ztc").val();
	var zs=$("#zs").val();
	var cs=$("#cs").val();
	var yfrq=$("#yfrq").val();
	var gy=$("#gy").val();
	var url = "wordChange.action?contentId="+id+"&editType="+val+"&docId="+docId+"&document.template="+template+"&document.top="+wt+"&document.postFont1="+postFont1+"&document.postFont2="+postFont2+"&document.postFont3="+postFont3+"&document.title="+fwbt+"&document.them="+ztc+"&document.writeFrom="+cs+"&document.printTime="+yfrq+"&document.print="+gy+"&document.sendFrom="+zs;
	openWindow(encodeURI(encodeURI(url)),screen.width,screen.height);
}

function topChange(val){
	if(val!=''){
	var font2=$("#postFont2").val();
	var param={"name":val,"department":font2,"status":"1"};
	$.post("getDispatcherTopShort.action",param,function(data){
		var shortName=data.shortName;
		var maxTop=data.maxTop;
		$("#postFont1").val(shortName);
		$("#postFont3").val(maxTop);
	},"json");
	}
}
function topChangeDate(val){
	if(val!=''){
	var wt=$("#wt").val();
	var param={"name":wt,"department":val,"status":"1"};
	$.post("getDispatcherTopShort.action",param,function(data){
		var maxTop=data.maxTop;
		$("#postFont3").val(maxTop);
	},"json");
	}
}

function typeChange(val){
	if(val!=''){
	var font2=$("#postFont2").val();
	$("#postFont1").val(val);
	var param={"name":val,"department":font2,"status":"2"};
	$.post("getReceiveType.action",param,function(data){
		var maxTop=data.maxTop;
		$("#postFont3").val(maxTop);
	},"json");
	}
}


function typeChangeDate(val){
	if(val!=''){
	var lx=$("#lx").val();
	var param={"name":lx,"department":val,"status":"2"};
	$.post("getReceiveType.action",param,function(data){
		var maxTop=data.maxTop;
		$("#postFont3").val(maxTop);
	},"json");
	}
}
</script>
  </head>
  
<body onload="download()">
<input type="hidden" id="currentPage" value="${currentPage}">
<form action="" method="post" name="documentForm" >
<div id="nodebutton" align="center">
	<input  class="button_04"   type="button" onclick="update();"  value="保存" />&nbsp;
</div>
<h1 align="center"style="color:#F00; font-weight:bold">${document.flowName}</h1>
<hr size="2" width="750px" color="#FF0000" />
<form action="" method="post" name="documentForm" >
<input type="hidden" name="document.fileArray" id="fileArray" value="${document.fileArray}">
<input type="hidden" name="document.id" value="${document.id}">
<input type="hidden" name="document.draftUser" value="${document.draftUser}">
<input type="hidden" name="document.draftStaus" value="${document.draftStaus}">
<input type="hidden" name="document.flowId" value="${document.flowId}">
<input type="hidden" name="document.sfstatus" value="${document.sfstatus}">
<input type="hidden" id="contentid" name="document.contentId" value="${document.contentId}">
<input type="hidden" name="document.processId" value="${document.processId}" >
<input type="hidden" id="templateId" name="document.template" value="${document.template}">
<table align="center" width="750px" border="0">
  <tr>
    <td class="sendtd">
    <table class="ztable" width="100%" border="0" cellpadding="0" cellspacing="0">
         <tr>
            <td height="30" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;<input class="button_04" id="zwbj"  type="button"  value="正文编辑" onclick="draftWord('2');" /></td>
          </tr>
          <tr>
            <td height="30" colspan="2">附件：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class="button_04" type="button"  id="fjsc"  value="上传附件" onclick="file_upload('filetable')" />
             <input type="button" class="button_02"  onclick="fileDel('filetable')"  value="删除"/>
            <table id="filetable">
			</table>
            </td>
          </tr>
          <tr>
            <td width="10%" height="80" valign="middle"> 
            附件表述：
            </td>
            <td width="90%" valign="middle"><textarea id="fjbs"  name="document.fjbs" cols="50" rows="4"  >${document.fjbs}</textarea></td>
          </tr>
    	</table>
    </td>
  </tr>
  <tr>
    <td class="sendtd">
  <table  class="ztable" width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="60%" >文头：<s:select id="wt" onchange="topChange(this.value)" list="topList" listKey="name" listValue="name" headerKey="" headerValue="" name="document.top" value="document.top"  cssStyle="width:200px;" theme="simple"></s:select></td>
            <td>发文字号：&nbsp;<span id="fwzh" >
			 <input  id="postFont1" type="text" name="document.postFont1" value="${document.postFont1}"  style="width:75px;" maxlength="20"/>
        <s:select id="postFont2"  onchange="topChangeDate(this.value)"  list="#{'[2007]':'2007','[2008]':'2008','[2009]':'2009','[2010]':'2010','[2011]':'2011','[2012]':'2012','[2013]':'2013','[2014]':'2014','[2015]':'2015','[2016]':'2016','[2017]':'2017','[2018]':'2018','[2019]':'2019','[2020]':'2020'}" name="document.postFont2" headerKey="" headerValue="" value="document.postFont2" theme="simple"></s:select>
        <input  id="postFont3"  type="text" name="document.postFont3" value="${document.postFont3}"  style="width:50px;" maxlength="20"/>
				</span><font color="#000000">号</font></td>
          </tr>
        </table>
    </td>
  </tr>
  <tr>
    <td class="sendtd">
  <table  class="ztable" width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="70%" >缓急程度：<s:select id="hjcd" list="#{'紧急':'紧急','加急':'加急','特提':'特提'}" headerKey="" name="document.hjStatu" value="document.hjStatu" headerValue="" theme="simple"></s:select></td>
            <td>印发日期：&nbsp;<input id="yfrq" name="document.printTime" onclick="WdatePicker({dateFmt:'%y年%M月%d日'})" value="${document.printTime}"  class="Wdate" style="width:130px" /></td>
          </tr>
        </table>
    </td>
  </tr>
  <tr>
    <td class="sendtd">
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="ztable">
      	<tr>
            <td>发文标题：</td>
        		<td><textarea id="fwbt" cols="60" rows="4" name="document.title" >${document.title }</textarea>&nbsp;<font style=" font-weight:bold">*</font></td>
          </tr>    
    </table>
	</td>
  </tr>
  <tr>
    <td class="sendtd">
    	<div class="ztable">
    		主题词：&nbsp;
            <input onclick="addSubject()" id="ztc" value="${document.them}" name="document.them" style=" width:500px;background:none;border-bottom:#999 double 1px; border-left:none; border-right:none; border-top:none" />
      </div>
	</td>
  </tr>
  <tr>
    <td class="sendtd"><table class="ztable" width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="10%" height="20" >主送：</td>
        <td>
        	<input id="zs" value="${document.sendFrom}" name="document.sendFrom" style=" width:500px;background:none;border-bottom:#999 double 1px; border-left:none; border-right:none; border-top:none" />
        </td>
      </tr>
      <tr>
        <td height="20">抄送：</td>
        <td>
        	<input id="cs"  name="document.writeFrom" value="${document.writeFrom }" style=" width:500px;background:none;border-bottom:#999 double 1px; border-left:none; border-right:none; border-top:none" />
        </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td class="sendtd">
    	<div class="ztable">拟文单位：&nbsp;
        	<input id="nwdw" value="${document.draftOrg }" name="document.draftOrg"  style=" width:350px;background:none;border-bottom:#999 double 1px; border-left:none; border-right:none; border-top:none" />
        </div>
    </td>
  </tr>
  <tr>
    <td class="sendtd">
    	<div class="ztable">拟稿人：&nbsp;
        	<input id="ngr" value="${document.draftName}" name="document.draftName" style=" width:350px;background:none;border-bottom:#999 double 1px; border-left:none; border-right:none; border-top:none" />
        </div>
    </td>
  </tr>
  <tr>
    <td class="sendtd">
    	<div class="ztable"><table><tr><td width="100px">承办单位意见：</td>
    		<td>${document.orgSugesstion}</td></tr>
    		</table> 
    		<textarea disabled="disabled" id="cbdwyj" style=" width:500px; height:10px; border:0; overflow:hidden" name="document.orgSugesstion"></textarea>
        </div>
    </td>
  </tr>
  <tr>
    <td class="sendtd">
    	<div class="ztable">
    	<table><tr><td width="100px">会签：</td>
    		<td>${document.counterSign}</td></tr>
    		</table> 
    		<textarea disabled="disabled" id="hq" style=" width:500px; height:10px; border:0; overflow:hidden" name="document.counterSign"></textarea>
        </div>
    </td>
  </tr>
  <tr>
    <td class="sendtd">
        <div class="ztable">
        <table><tr><td width="100px">核稿：</td>
    		<td>${document.checkDraft}</td></tr>
    		</table> 
       		<textarea disabled="disabled" id="hg" style=" width:500px; height:10px; border:0; overflow:hidden" name="document.checkDraft"></textarea>
        </div>
    </td>
  </tr>
  <tr>
    <td class="sendtd">
    	 <div class="ztable">
		<table><tr><td width="100px">审阅意见：</td>
    		<td>${document.syyj}</td></tr>
    		</table>
       		<textarea disabled="disabled" id="syyj" style=" width:500px; height:10px; border:0; overflow:hidden" name="document.syyj"></textarea>
      	 </div>
    </td>
  </tr>
  <tr>
    <td class="sendtd">
    	<div class="ztable">
    	<table><tr><td width="100px">审核意见：</td>
    		<td>${document.shyj}</td></tr>
    		</table>
  	       		<textarea disabled="disabled" id="shyj" style=" width:500px; height:10px; border:0; overflow:hidden" name="document.shyj"></textarea>
		</div>
    </td>
  </tr>
  <tr>
    <td class="sendtd">
    	<div class="ztable">
    	<table><tr><td width="100px">签发：</td>
    		<td>${document.signOff}</td></tr>
    		</table>
  	       		<textarea disabled="disabled" id="qf" style=" width:500px; height:10px; border:0; overflow:hidden" name="document.signOff"></textarea>
	  </div>
    </td>
  </tr>
  <tr>
    <td class="sendtd">
    	<div class="ztable">共印：
        	<input type="text" value="${document.print}" id="gy" name="document.print" disabled="disabled" style="width:45px; height:15px; background:none; text-align:center" />&nbsp;份
        </div>
    </td>
  </tr>
</table>
<input type="hidden" name="document.supervision" value="${document.supervision }">
</form>
<table style="border: 1px solid; color:#ffffff" align="center" width="80%" border="0" cellspacing="1" cellpadding="0" bgcolor="#999999" >
		<c:forEach items="${hisList}"  var="his">
		<tr>
		<td style="background: #ffffff" width="10%"> <font color="black">${his.userName}</font></td>
		<td style="background:#ffffff" > <font color="black">${his.content}</font></td>
		<td style="background:#ffffff" width="18%"> <font color="black"> <fmt:formatDate value="${his.updateTime}" type="both"/></font></td>
		</tr>
		</c:forEach>
	</table>
</body>
</html>
